package 两两交换链表中的节点;

public class Test3 {
    public static void main(String[] args) {

        ListNode l6 = new ListNode(0, null);
        ListNode l5 = new ListNode(1, l6);
        ListNode l4 = new ListNode(2, l5);
        ListNode l3 = new ListNode(3, l4);
        ListNode l2 = new ListNode(4, l3);
        ListNode l1 = new ListNode(5, l2);
        ListNode head = new ListNode(6, l1);

        /*ListNode l1 = new ListNode(5, null);
        ListNode head = new ListNode(6, l1);*/

        /*ListNode head = new ListNode(6, null);*/

        /*ListNode l2 = new ListNode(4, null);
        ListNode l1 = new ListNode(5, l2);
        ListNode head = new ListNode(6, l1);*/


        printM(head);
        Solution3 s1 = new Solution3();
        ListNode newHead = s1.swapPairs(head);

        printM(newHead);

    }

    public static void printM(ListNode head) {
        ListNode p = new ListNode();
        p = head;
        while (p != null) {
            System.out.print(p.val + " ");
            p = p.next;
        }
        System.out.println();
    }

}
